<?php
/**
 * Created by PhpStorm.
 * User: Kau
 * Date: 2018/3/20
 * Time: 1:20
 */
namespace app\common\model;

use think\Model;

abstract class BaseModel extends Model
{
    protected $autoWriteTimestamp = true;
    public function add($data)
    {
        $data['status'] = 0;
        $this->save($data);
        return $this->id;
    }

    public function updateById($data, $id)
    {
        // allowField 过滤数组中非数据表中的数据
        return $this->allowField(true)->save($data, ['id' => $id]);
    }
}